package com.wc.AlgoOJ_train.train6_图论.图论.汉密尔顿回路;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/4/15 14:59
 * @description http://43.138.190.70:8888/p/GR0104
 */
public class Main {
    /**
     * 思路：dfs
     */
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 10, M = N * N;
    static boolean[][] g = new boolean[N][N];
    static int[] h = new int[N];
    static int[] ne = new int[M];
    static int[] e = new int[M];
    static int idx = 1;
    static boolean flg = false;
    // 表示这个点是否已经被访问过
    static boolean[] st = new boolean[N];
    static int n, m, k;

    public static void main(String[] args) {
        n = sc.nextInt();
        m = sc.nextInt();
        while (m-- > 0) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            g[a][b] = g[b][a] = true;
            add(a, b);
            add(b, a);
        }
        k = sc.nextInt();
        dfs(k, 0);
        if (flg) out.println("Yes");
        else out.println("No");
        out.flush();
    }

    static void add(int a, int b) {
        e[idx] = b;
        ne[idx] = h[a];
        h[a] = idx++;
    }

    static void dfs(int u, int step) {
        if (step == n - 1) {
            if (g[u][k]) flg = true;
            return;
        }
        if (flg) return;
        st[u] = true;
        for (int i = h[u]; i > 0; i = ne[i]) {
            int j = e[i];
            if (!st[j]) dfs(j, step + 1);
        }
        st[u] = false;
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}
